//
//  KPFloatButton.swift
//  KPBaseProject
//
//  Created by Kipp Dev on 2018/4/10.
//  Copyright © 2018年 Kipp. All rights reserved.
//

import Material


class KPFloatButton: WMDragView {
    override init(frame: CGRect) {
        super.init(frame: frame)
        prepareView()
    }

    override func layoutSubviews() {
        super.layoutSubviews()
        button.frame = self.bounds
    }

    convenience init() {
        self.init(frame: .zero)
        prepareView()
    }

    // MARK: - 创建视图
    fileprivate func prepareView() {
        backgroundColor = .clear
        button.removeFromSuperview()

        button = IconButton(image: nil).then {
            $0.clipsToBounds = true
            addSubview($0)
        }
        freeRect = CGRect.init(x: 0, y: kNavibarH, width: Screen.width, height: Screen.height - kNavibarH)
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
